<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var a = 10;

    function test(){
        console.log(a);
        a = 20;
    }
    test();
    console.log(a);
</script>
</body>
</html>